#include<stdio.h>
#include<ctype.h>
#include<string.h>
#include<stdlib.h>
void zhuan(char str[],char end[])
{
    int a = 0;
    int b =0;

    for (int i = 0; str[i] != '\0'; i++)
    {
        if (str[i] != ' ')
            end[b++] = tolower(str[i]);
        
        

    }
    end[b] = '\0';
}
int main()
{
    char arr1[1001], arr2[1001];
    char end1[1001], end2[1001];
    fgets(arr1, 1000, stdin);
    fgets(arr2, 1000, stdin);

    arr1[strcspn(arr1, "\n")] = '\0';
    arr2[strcspn(arr2, "\n")] = '\0';

    zhuan(arr1,end1);
    zhuan(arr2,end2);
    if (strcmp(end1, end2) == 0)
    {
        printf("YES");
    }
    else
    {
        printf("NO");
    }
    return 0;
}